<template>
	<view class="nav-bar b-b">
		<view
			class="nav-item" 
			v-for="(item, index) in navs" 
			:key="index"
			@click="navChange(index)"
		>
			<view class="tit-wrap">
				<text class="tit" :class="{'active': current == index}">{{ item.name }}</text>
			</view>
			<view class="line" :class="{'line--show': current === index}"></view>
		</view>
	</view>
</template>

<script>
	/**
	 * 顶部tab栏
	 */
	export default {
		data(){
			return {
				countList: [],
				current:0
			}
		},
		props: {
			navs: {
				type: Array,
				default(){
					return [
						{name: '负责跟进'},
						{name: '本周待提交'},
						{name: '本周待审核'}
					];
				}
			},
		
			counts: {
				type: Array,
				default(){
					return [];
				}
			}
		},
		watch: {
			
		},
		methods: {
			navChange(index){
				this.current = index;
				this.$emit('onChange', index);
			}
		}
	}
</script>

<style scoped lang='scss'>
	/* #ifndef APP-NVUE */
	view{
		display: flex;
		flex-direction: column;
	}
	/* #endif */
	.fill-view{
		height: 70rpx;
		width: 100%;
	}
	.nav-bar{
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: space-around;
		width: 750rpx;
		height: 70rpx;
		background-color: #fff;
		
		/* &:after{
			border-color: #f7f7f7;
		} */
	}
	.nav-item{
		flex: 1;
		align-items: center;
		justify-content: center;
		height: 70rpx;
		/* padding-top: 4rpx; */
		position: relative;
	}
	.tit-wrap{
		flex: 1;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		position: relative;
	}
	.tit{
		font-size: 24rpx;
		color: #808080;
	}
	.active{
		color: #0099cc;
		/* font-weight: 700; */
	}
	.line{
		width: 100rpx;
		height: 6rpx;
		border-radius: 4rpx;
		background-color: #0099cc;
		opacity: 0;
		
		&--show{
			opacity: 1;
		}
	}
</style>
